package tennos;

import static mathUtils.VecMath.*;
import processing.core.*;
import viscosity.Viscous;
import dynamics.Dynamics;
import forces.Forceable;

public class Flake extends Fleck implements Dynamics, Forceable, Viscous {
	public float mass;
	public float radius;
	
	static boolean showVelocity;
	
	public Flake(PApplet p) {
		super(p);
	}
	public Flake(PApplet p, float m, float r, float px, float py, float vx, float vy) {
		super(p, px, py, vx, vy);
		mass = m; 
		radius = r;
	}

	public float mass() {return mass;}
	public void setMass(float m) {mass = m;}

	public float kineticEnergy() {return 0.5f*mass*vecMag2(velocity());}
	public float[] momentum() {
		float p[] = vecCloneSpace(velocity());
		vecMult(velocity(), mass, p);
		return null;
	}

	public void clearAcceleration() {
		vecZero(acceleration());
	}
	public void takeForce(float[] f) {
		//System.out.println("       Flake a = " + acceleration()[0] + ", " + acceleration()[1]);
		//System.out.println("             F = " + f[0] + ", " + f[1]);
		vecAddScaled(acceleration(), f, 1f/mass, acceleration());
		//System.out.println("             a = " + acceleration()[0] + ", " + acceleration()[1]);
		
	}

	public float[] position() {return s[0];}
	public float[] velocity() {return s[1];}
	public float[] acceleration() {return ds[1];}	
	
}
